package com.spring.sunflower.login

import android.view.View
import android.widget.CheckBox
import android.widget.LinearLayout
import android.widget.TextView
import com.spring.sunflower.R
import com.spring.sunflower.base.BaseCompatActivity

/**
 * Created by Kevin on 2021/8/19<br/>
 *
 * Describe:<br/>
 */
class LoginActivityTemp : BaseCompatActivity(), View.OnClickListener {
    private var llLoginByWeChat: LinearLayout? = null
    private var llLoginByQQ: LinearLayout? = null
    private var llLoginByPhone: LinearLayout? = null
    private var checkBox: CheckBox? = null
    private var tvAgreement: TextView? = null
    private var tvPrivateAgreement: TextView? = null
    override fun initView() {
        llLoginByWeChat = findViewById(R.id.llLoginByWeChat)
        llLoginByQQ = findViewById(R.id.llLoginByQQ)
        llLoginByPhone = findViewById(R.id.llLoginByPhone)
        llLoginByWeChat?.setOnClickListener(this)
        llLoginByQQ?.setOnClickListener(this)
        llLoginByPhone?.setOnClickListener(this)
        checkBox = findViewById(R.id.checkBox)
        tvAgreement = findViewById(R.id.tvAgreement)
        tvPrivateAgreement = findViewById(R.id.tvPrivateAgreement)
        tvAgreement?.setOnClickListener(View.OnClickListener { v: View ->
            onClick(
                v
            )
        })
        tvPrivateAgreement?.setOnClickListener(View.OnClickListener { v: View ->
            onClick(
                v
            )
        })
    }

    override fun getLayoutID(): Int {
        return R.layout.activity_login_temp
    }

    override fun onClick(v: View) {
        if (isFastClick) return
        when (v.id) {
            R.id.llLoginByPhone -> if (checkBox!!.isChecked) {
                startNewActivity(LoginByPhoneActivity::class.java)
            } else {
                showToast("请勾选同意协议")
            }
            R.id.llLoginByQQ -> {
            }
            R.id.llLoginByWeChat -> {
            }
            R.id.tvAgreement -> goAgreement()
            R.id.tvPrivateAgreement -> goPrivateAgreement()
        }
    }
}